﻿using NHibernate;
using NHibernate.Criterion;

namespace FwkLight.Domain
{
  public static class CriteriaExtension
  {
    public static ICriteria EnsureItWillSatisfy<T>(this ICriteria criteria, ICriteriaSpecification<T> specificationToSatisfy)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria);
    }

		public static ICriteria EnsureItWillSatisfy<T, Param1>(this ICriteria criteria, ICriteriaSpecification<T, Param1> specificationToSatisfy, Param1 param1)
		{
			return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1);
		}

    public static ICriteria EnsureItWillSatisfy<T, Param1, Param2>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2> specificationToSatisfy, Param1 param1, Param2 param2)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2);
    }

    public static ICriteria EnsureItWillSatisfy<T, Param1, Param2, Param3>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3);
    }

    public static ICriteria EnsureItWillSatisfy<T, Param1, Param2, Param3, Param4>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3, Param4> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3, Param4 param4)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3, param4);
    }

    public static ICriteria WhichCan<T>(this ICriteria criteria, ICriteriaSpecification<T> specificationToSatisfy)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria);
    }

		public static ICriteria WhichCan<T, Param1>(this ICriteria criteria, ICriteriaSpecification<T, Param1> specificationToSatisfy, Param1 param1)
		{
			return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1);
		}

    public static ICriteria WhichCan<T, Param1, Param2>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2> specificationToSatisfy, Param1 param1, Param2 param2)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2);
    }

    public static ICriteria WhichCan<T, Param1, Param2, Param3>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3);
    }

    public static ICriteria WhichCan<T, Param1, Param2, Param3, Param4>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3, Param4> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3, Param4 param4)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3, param4);
    }

    public static ICriteria EntityWhich(this ICriteria criteria)
    {
      return criteria;
    }

    public static DetachedCriteria EntityWhich(this DetachedCriteria criteria)
    {
      return criteria;
    }

    public static ICriteria Are<T>(this ICriteria criteria, ICriteriaSpecification<T> specificationToSatisfy)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria);
    }

		public static ICriteria Are<T, Param1>(this ICriteria criteria, ICriteriaSpecification<T, Param1> specificationToSatisfy, Param1 param1)
		{
			return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1);
		}

    public static ICriteria Are<T, Param1, Param2>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2> specificationToSatisfy, Param1 param1, Param2 param2)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2);
    }

    public static ICriteria Are<T, Param1, Param2, Param3>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3);
    }

    public static ICriteria Are<T, Param1, Param2, Param3, Param4>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3, Param4> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3, Param4 param4)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3, param4);
    }

    public static ICriteria Is<T>(this ICriteria criteria, ICriteriaSpecification<T> specificationToSatisfy)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria);
    }

		public static ICriteria Is<T, Param1>(this ICriteria criteria, ICriteriaSpecification<T, Param1> specificationToSatisfy, Param1 param1)
		{
			return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1);
		}

    public static ICriteria Is<T, Param1, Param2>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2> specificationToSatisfy, Param1 param1, Param2 param2)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2);
    }

    public static ICriteria Is<T, Param1, Param2, Param3>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3);
    }

    public static ICriteria Is<T, Param1, Param2, Param3, Param4>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3, Param4> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3, Param4 param4)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3, param4);
    }

    public static DetachedCriteria Is<T>(this DetachedCriteria criteria, IFullSpecification<T> specificationToSatisfy)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria);
    }

		public static DetachedCriteria Is<T, Param1>(this DetachedCriteria criteria, IFullSpecification<T, Param1> specificationToSatisfy, Param1 param1)
		{
			return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1);
		}

    public static DetachedCriteria Is<T, Param1, Param2>(this DetachedCriteria criteria, IFullSpecification<T, Param1, Param2> specificationToSatisfy, Param1 param1, Param2 param2)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2);
    }

    public static DetachedCriteria Is<T, Param1, Param2, Param3>(this DetachedCriteria criteria, IFullSpecification<T, Param1, Param2, Param3> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3);
    }

    public static DetachedCriteria Is<T, Param1, Param2, Param3, Param4>(this DetachedCriteria criteria, IFullSpecification<T, Param1, Param2, Param3, Param4> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3, Param4 param4)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3, param4);
    }

		public static ICriteria CanBe<T>(this ICriteria criteria, ICriteriaSpecification<T> specificationToSatisfy)
		{
			return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria);
		}

		public static ICriteria CanBe<T, Param1>(this ICriteria criteria, ICriteriaSpecification<T, Param1> specificationToSatisfy, Param1 param1)
		{
			return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1);
		}

    public static ICriteria CanBe<T, Param1, Param2>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2> specificationToSatisfy, Param1 param1, Param2 param2)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2);
    }

    public static ICriteria CanBe<T, Param1, Param2, Param3>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3);
    }

    public static ICriteria CanBe<T, Param1, Param2, Param3, Param4>(this ICriteria criteria, ICriteriaSpecification<T, Param1, Param2, Param3, Param4> specificationToSatisfy, Param1 param1, Param2 param2, Param3 param3, Param4 param4)
    {
      return specificationToSatisfy.EnsureThatWillBeSatisfiedBy(criteria, param1, param2, param3, param4);
    }

  }
}